package ar.edu.uba.fi.jmit.monitorengine.mock;

import java.io.Serializable;
import java.util.Map;

import ar.edu.uba.fi.jmit.integrationcommons.Event;
import ar.edu.uba.fi.jmit.integrationcommons.EventPriority;
import ar.edu.uba.fi.jmit.monitorengine.core.AbstractRangeObserver;
import ar.edu.uba.fi.jmit.monitorengine.core.Monitor;

public class MockRangeObserver extends AbstractRangeObserver {
	
	private Long actualMonitorValue;

	@Override
	protected Event createEvent(Monitor monitor, Map<String, Serializable> data) {
		Event event = new Event();
		event.setData(data);
		EventPriority priority;
		if(this.isAlert()) {
			priority = EventPriority.ALERT;
		}else {
			priority = EventPriority.NORMAL;
		}
		event.setPriority(priority);
		event.setSource(getName());
		return event;
	}

	@Override
	protected Long getMonitorActualValue(Monitor monitor) {
		return actualMonitorValue;
	}

	public void setActualMonitorValue(Long actualMonitorValue) {
		this.actualMonitorValue = actualMonitorValue;
	}
	
}
